package BALockRefine;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Main {

    public static void main(String args[]) {

        Lock lock = new ReentrantLock();

        Account a = new Account();
        a.setAccountNo(111);
        a.setBalance(1000);
        DepositThread t1;
        WithdrawThread t2;
        t1 = new DepositThread(a, 500, lock);
        t2 = new WithdrawThread(a, 900, lock);

        for (int i = 0; i < 10; i++) {
            new Thread(t1).start();
            new Thread(t2).start();
        }
    }
}
